package com.example.demo;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

/**
 * 生产消息
 * @author binbin.zhang
 *
 */
@EnableBinding(Source.class)
public class Product {
	@Autowired
	@Output(Source.OUTPUT)
	private MessageChannel channel;

	public void send() {
		channel.send(MessageBuilder.withPayload(UUID.randomUUID().toString()).build());
	}
}
